package cn.cxyxj.code_resource_prod.code_resource.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@RequestMapping("/user")
public class UserController {

    /**
     * 获得用户详情
     * @return
     */
    @GetMapping("/get-user-info")
    public String getUserInfo() {
        return "hello get-user-info";
    }

    /**
     * 获得用户菜单树
     * @return
     */
    @GetMapping("/get-menu-tree")
    public String getMenuTree() {
        return "hello get-menu-tree";
    }

    /**
     * 获取当前用户信息，供客户端获取
     */
    @GetMapping("/get-current-user")
    public Principal getCurrentUser(Principal principal) {
        System.out.println("get-current-user");
        return principal;
    }
}